#ifndef SERVER_SQL_H
#define SERVER_SQL_H
#include "QtCore"
#include "thread.h"
#include "inner_msg.h"
#include "sql.h"
class Inner_Msg;
class Server_Sql:Thread
{
    Q_OBJECT
public:
    static Server_Sql* gethand()
    {
        if(global_sql == nullptr)
            global_sql = new Server_Sql();
        return global_sql;
    }
    void ReturnTask(Inner_Msg *obj);
    void AddTask(Inner_Msg *obj);
private:
    explicit Server_Sql();
    void Init_Sql();
    void SQL_Task();
    void Close_Sql();

    QQueue<Inner_Msg*> TaskToDo;

    void process();
    static Server_Sql * global_sql;
};
#endif // SERVER_SQL_H
